%def_disable coverage

Name: apt-repo-tools
Version: 0.8.0
Release: alt1

Summary: Utilities to create APT repositories
License: GPLv2+
Group: Development/Other

Source: %name-%version.tar

Requires: librpmio(PGPHASHALGO_BLAKE2B)%{?_is_libsuff:(%{_libsuff}bit)} = 100
Provides: apt-utils = 0.5.15lorg4
Obsoletes: apt-utils <= 0.5.15lorg4

BuildRequires: gcc-c++ libapt-devel librpm-devel
%if_enabled coverage
BuildRequires: lcov
%endif

%description
This package contains the utility programs that can prepare a repository
of RPMS binary and source packages for future access by APT (by
generating the indices): genbasedir, genpkglist, gensrclist.

%prep
%setup

%build
# To avoid some errors on API change:
%add_optflags -Werror=overloaded-virtual
# A style enforcement: always use the keyword, which helps to avoid API misuse
%add_optflags -Werror=suggest-override
%add_optflags -Werror=return-type
./bootstrap
mkdir build
cd build
%define _configure_script ../configure
%configure \
	%{?_enable_coverage:--enable-code-coverage} \
	%nil
%make_build

%install
%makeinstall_std -C build
mkdir -p %buildroot/var/cache/apt/gen{pkg,src}list

%check
%make_build check -C build VERBOSE=1
%if_enabled coverage
make code-coverage-capture -C build
%endif

%files
/usr/bin/genpkglist
/usr/bin/gensrclist
/usr/bin/genbasedir
/usr/bin/pkglist-query
%defattr(2770,root,rpm,2770)
%dir /var/cache/apt/genpkglist
%dir /var/cache/apt/gensrclist

%changelog
* Thu Oct 28 2021 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.8.0-alt1
- Switched to librpm crypto API instead of libapt.
- Added support and enabled blake2b hash by default.
- genbasedir: add --disable-hash-caching option to disable hashsum caching.

* Fri Mar 12 2021 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.7.1-alt1
- genbasedir/genpkglist: fixed generation of non-flat repositories.
- genbasedir (imz@):
  + Fixed SIGPIPE in the old non-patching mode. (It was due to a race.)
  + Fixed patching srclist in-place when there is no uncompressed srclist.
  + Fixed patching a basedir if there is a spurious {pkg,src}list.*.old file
    there, but no uncompressed {pkg,src}list.*.
  + Fixed a potential bug (due to a race) of choosing the overwritten
    output file as input for patching.
  + Report an error when patching and the previous list can't be found.
  + Do the search for the previous list the same way no matter whether
    --prev-basedir was specified or patching "in-place".

* Mon Oct 26 2020 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.7.0-alt1
- Added new options to patch package index.
- Added --basedir option to specify base directory name.
- genbasedir: added support for zstd-compressed package lists.
- genpkglist, gensrclist:
  + removed --append option;
  + removed --meta option.
- genpkglist: fixed --cachedir description in usage (ALT#38293).
- imz@:
  + (.spec) Just added some compiler flags (which don't change anything) to be
  sure that APT API has not been used wrongly and will not be.  (Namely, to be
  sure that if a method override was intended, it would actually be overriding
  and not hiding a virtual method and that it would be marked "override" for
  future.).

* Mon Jan 21 2019 Vladimir D. Seleznev <vseleznv@altlinux.org> 0.6.0.22-alt1
- genpkglist: added DistTag.
- genbasedir (by glebfm@):
  + added --compressedonly alias for --bz2only option;
  + added --{,no-}bz2 and --{,no-}xz to usage.
- Dropped Vendor tag from {pkg,src}list (by glebfm@).

* Fri Jul 21 2017 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.6.0.21-alt1
- Changes for gen{pkglist,basedir} (from Alexey Tourbin):
  + introduced startswith function;
  + removed support for oldhashfile;
  + fixed partial changelog copying.
- Rebuilt with libapt-pkg-libc6.9-6.so.7.

* Tue Aug 30 2016 Alexey Gladkov <legion@altlinux.ru> 0.6.0.20-alt1
- Port to rpm-4.13.

* Thu May 28 2015 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.6.0.19-alt1.1.1
- Rebuilt for:
  + libapt-pkg-libc6.9-6.so.5.
  + gcc5 C++11 ABI.

* Wed Sep 10 2014 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.6.0.19-alt1.1
- Rebuilt with libapt-pkg-libc6.9-6.so.4.

* Tue Jul 01 2014 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.6.0.19-alt1
- genpkglist:
  + Dropped OS.
- gensrclistlist:
  + Dropped OS and SOURCERPM.
- Rebuilt with rpm-4.0.4-alt100.78 (different size of rpmTagTable).

* Mon May 19 2014 Gleb F-Malinovskiy <glebfm@altlinux.org> 0.6.0.18-alt1
- genpkglist: add buildtime.

* Tue Mar 11 2014 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.17-alt2
- Rebuilt.

* Fri Jan 11 2013 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.17-alt1
- Enabled LFS support.

* Tue Apr 03 2012 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.16-alt1
- gen{pkg,src}list: redirected all error messages to cerr,
  made package read errors fatal.

* Fri Mar 30 2012 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.15-alt1
- genbasedir: update release files properly (closes: #26260).

* Tue Nov 01 2011 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.14-alt1
- genpkglist: add ttf and otf fonts to useful files
  (by Igor Vlasenko; closes: #26520).

* Tue Aug 30 2011 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.13-alt1
- genbasedir: synced with the version used by girar-builder.

* Thu Dec 23 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.12-alt1
- genbasedir: enabled --maybe-unchanged logic for srclists as well
- genbasedir: fixed --maybe-unchanged for multi-component repo (#24433)

* Sat Dec 18 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.11-alt1
- genbasedir: minor compression tweak

* Fri Dec 17 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.10-alt1
- genbasedir: renice bzip2 when running along with non-parallel xz

* Fri Dec 17 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.9-alt1
- genbasedir: implemented 2-way xz parallel compression

* Sun Nov 28 2010 Dmitry V. Levin <ldv@altlinux.org> 0.6.0.8-alt1
- genpkglist: add java jars to useful files (viy@; closes: #24649).

* Tue Aug 17 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.7-alt1
- genbasedir: implemented --maybe-unchanged option, for use in girar-builder

* Thu Jun 10 2010 Alexey Tourbin <at@altlinux.ru> 0.6.0.6-alt1
- genbasedir: added support for xz-compressed pkglists
- genbasedir: run bzip2 and xz in background

* Mon Dec 21 2009 Alexey I. Froloff <raorn@altlinux.org> 0.6.0.5-alt1.1
- NMU:
  + rebuilt with apt 0.5.15lorg2-alt31.1

* Sun Oct 25 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0.5-alt1
- genpkglist.cc: implemented "--changelog-since seconds" option
- genbasedir: implemented --changelog-since=DATE option

* Sun Oct 25 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0.4-alt1
- genpkglist.cc: group binary packages by src.rpm

* Sun Sep 27 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0.3-alt1
- genpkglist.cc: fixed first-pass memory leak

* Tue Jul 14 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0.2-alt1
- genbasedir: replaced 'bzip2 -9' with 'bzip2', to make BZIP2=--fast work

* Thu Jul 09 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0.1-alt1
- genpkglist: added /usr/games and /usr/lib/kde4bin directories

* Wed Apr 22 2009 Alexey Tourbin <at@altlinux.ru> 0.6.0-alt1
- this package provides and obsoletes apt-utils
- genpkglist: reimplemented support for file-level dependencies
- genpkglist: removed /etc/ from usefulFile patterns
- genpkglist: file dups are now stripped as well
- genpkglist: added --useful-files=FILE option
- genpkglist: added --no-scan option
- genbasedir: pass --no-scan and --useful-files=FILE to genpkglist
- genbasedir: pass --cache-dir=DIR to genpkglist and gensrclist
- pkglist-query: new program, obsoletes countpkglist
